<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>个人资料</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" type="text/css" href="/zhenze/Public/home/css/reset.css"/>
		<link rel="stylesheet" href="/zhenze/Public/home/css/gerenziliao.css" />
		<link rel="stylesheet" href="/zhenze/Public/home/css/font-awesome.min.css" />
		<link rel="stylesheet" href="/zhenze/Public/home/css/app.css" />
		<link rel="stylesheet" href="/zhenze/Public/home/css/mui.min.css" />
		<link rel="stylesheet" href="/zhenze/Public/home/css/mui.picker.min.css" />
	</head>
	<body>
		<div class="top">
			<a href="<?php echo U('index/userinfo');?>"><i class="fa fa-angle-left"></i></a>
			<p>个人资料</p>
		</div>
		<form name="myform" id="myform" action="<?php echo U('index/myinfo');?>" method="post">
		<ul class='list'>
			<li><p id="p1">头像</p><p></p><img id="img" src="<?php echo ($userinfo["avatar"]); ?>" /></li>
			<li><p>昵称</p><p><?php echo ($userinfo["nickname"]); ?></p></li>
			<li>
				<p>性别</p>
				<p></p>
				<select id="sele" name="info[sex]" class="mui-btn mui-btn-block">
					<option value="男" <?php if($userinfo["sex"] == '男' ): ?>selected<?php endif; ?>>男</option>
					<option value="女" <?php if($userinfo["sex"] == '女' ): ?>selected<?php endif; ?>>女</option>
					<option value="保密" <?php if(($userinfo["sex"] == '保密') or ($userinfo["sex"] == '') ): ?>selected<?php endif; ?>>保密</option>
				</select>
			</li>
			<li><p>生日</p><p><button id='demo4' data-options='{"type":"date"}' class="btn mui-btn mui-btn-block"><?php echo ((isset($userinfo["birthday"]) && ($userinfo["birthday"] !== ""))?($userinfo["birthday"]):"选择日期"); ?></button></p></li>
			<li><p>手机</p><p></p><input id="te" name="info[mobile]" type="tel" onkeyup='this.value=this.value.replace(/\D/gi,"")' maxlength="11" value="<?php echo ($userinfo["mobile"]); ?>" ></li>
			<li><p>学校</p><p></p><input id="text0" name="school" type="text" placeholder="输入您的学校" value="<?php echo ($userinfo["schoolname"]); ?>" /></li>
			<input id="school" name="info[school]" type="hidden" value="<?php echo ($userinfo["school"]); ?>" >
			<input id="birthday" name="info[birthday]" type="hidden" value="<?php echo ($userinfo["birthday"]); ?>" >
		</ul>
		<button class="btn00">确定</button>
		</form>
		<script src="/zhenze/Public/home/js/screenSize.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript" src="/zhenze/Public/home/js/mui.min.js" ></script>
		<script type="text/javascript" src="/zhenze/Public/home/js/mui.picker.min.js" ></script>
		<script type="text/javascript" src="/zhenze/Public/home/js/jquery-3.1.1.min.js" ></script>

		<link rel="stylesheet" type="text/css" href="/zhenze/Public/jquery-ui/jquery-ui.css"></link>
		<script type="text/javascript" src="/zhenze/Public/jquery-ui/jquery-ui.js"></script>
		<script>
			(function($$) {
				$$.init();
				var result = $$('#result')[0];
				var btns = $$('.btn');
				btns.each(function(i, btn) {
					btn.addEventListener('tap', function() {
						//var optionsJson = this.getAttribute('data-options') || '{}';
						var optionsJson = '{"type":"date","beginYear":1950}';
						var options = JSON.parse(optionsJson);
						var id = this.getAttribute('id');
						var picker = new $$.DtPicker(options);
						picker.show(function(rs) {
							demo4.innerText =  rs.text;
							$("#birthday").val(rs.text);
							picker.dispose();
						});
					}, false);
				});
			})(mui);

			$(function(){
				$( "#text0" ).autocomplete({
					source: function(request,response) {
						$.ajax({
							url: "<?php echo U('index/getschool');?>",
							dataType: "json",
							data: {
								key: request.term
							},
							success: function( data ) {
								response( data );
							}
						});
					},
					minLength: 1,
					autoFocus: true,
					select: function( event, ui ) {
						console.log(ui);
						$("#school").val(ui.item.id);
					}
				});
			  } );
		</script>
	</body>
</html>